var replaceDiv = null;

var W_SITEID = "";
//地图数据编辑
require(["esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/layers/MapImageLayer", "esri/layers/support/Field", "esri/geometry/Point", "esri/Basemap", "esri/geometry/Extent", "esri/Graphic", "esri/layers/WebTileLayer",],
    function (Map, MapView, FeatureLayer, MapImageLayer, Field, Point, Basemap, Extent, Graphic, WebTileLayer) {
        //换个地图
        var map = new Map({
            basemap: new Basemap({
                // baseLayers: [new WebTileLayer({
                //     urlTemplate: pathUlr + ":2674/roadmap/{level}/{col}/{row}.png",
                // })]
                baseLayers: [
                    new MapImageLayer({
                        url: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer",
                        title: "Basemap"
                    })
                ],
            })
        });



        var view = new MapView({
            container: "viewDiv",
            map: map,
            zoom: 11,
            center: [113.968668, 22.474748],
        });

        view.extent = new Extent({
            xmin: 12656100,
            ymin: 2601800,
            xmax: 12753600,
            ymax: 2573900,
            spatialReference: {
                wkid: 102100
            }
        });


        var em = new Vue({
            el: main,
            data: {
                leftNum: 0, //用来判断左侧菜单的样式，选取0位第一个
                subisActive: false,
                subisClose: false,
                subButJudge: false,
                subButShow: false,
                queryShow: false, //没有查询结果
                queryReust: true, //影像数据--开！
                observe: false, //观测数据--关！
                history: false, //历史数据--关！
                weatherReust: false,//气象数据--关！
                tableActiveShow: false, //该死的要挤过去
                baseQueryValue: '', //基础查询数据
                queryData: '', //日期
                baseQueryArea: '', //查询区域
                checkAll: false,
                checkedCities: [],
                cities: cityOptions,
                isIndeterminate: true,
                mapShow: true, //地图是否展示
                webWeatherValue: "",
                menuLefts: [{ //构建的左侧菜单选项
                    title: messages.en.baseData.imageData,
                    url: "../img/home/imageDataS.png"
                }, {
                    title: messages.en.baseData.meteData,
                    url: "../img/home/meteData.png"
                }, {
                    title: messages.en.baseData.obseData,
                    url: "../img/home/obseData.png"
                }, {
                    title: messages.en.baseData.historData,
                    url: "../img/home/historData.png"
                }],
                basicDataOptions: analBaseData,
                regionOptions: null, //行政区域查询条件
                resultData: null, //查询出来的数据
                indexNubmer: 0,
                //影像数据
                imageTypeSelectData: null,
                imageTypeSelectValue: "",
                HistoryImage: true,
                ImageDate: null,
                //气象数据
                WeatherWebDataOption: WeatherWebData_en,//网站选择列表
                WeatherWebDataValue: "",//网站选择的值
                baseWeatherArea: "",   //气象数据 区域 选择结果
                baseAreaOption: "",        //下拉框的值
                baseWeatherSite: "",    //站点的值
                baseSiteOption: "",     //站点下拉框的值
                areaSiteDisplay: true,
                //观测数据
                ObsDataValue: "",        //类别
                ObsDataOption: obsSelectOData_en,
                ObsSiteValue: "",        //站点
                ObsSiteOption: null,
                moreInputVal: "",        //更多ID
                //历史数据
                HistoryValue: "",
                HistoryOption: HistroySelectOData_en,
                HistorySiteValue: "",
                HistorySiteOption: "",
                HistoryDate: null, //日期范围
                //分页
                prev: "",
                pager: "",
                next: "",
                pageCount: 200,
                //表格数据
                tableData: null, //模拟表格数据
                tableImg: null,  //太阳辐射图片集合
                //各项表格显示和隐藏
                HistoryHK: false,             //香港表格
                HistoryChaoxi: false,        //潮汐表格
                HistoryShuizhi: false,       //水质表格
                HistorySz: false,            //深圳表格
                HistorySun: false,           //太远辐射表格
                //深圳气象网七天数据
                SpanHtmlSeven: null,  //这个是显示更多Elemetn
                sevenDayLayerVisible: false, //弹窗
                IframeSrc: null,
                dialogTitle: "",
                //翻译
                interpret:messages.en.baseData,
            }, created: function () {
                // console.log(this.weatherReust);
                // this.getWeatherJosn();//初始化区域数据
                window.parent.toggleLoading();
                var languageType = this.common.Initial();
                // console.log(languageType);


            },
            watch: {
                'WeatherWebDataValue': {
                    handler(newValue, oldValue) {
                        this.loaddingDo();//加载框
                        //需要清除另外两个下拉框
                        this.baseWeatherArea = null;
                        this.baseWeatherSite = null;
                        if (newValue == '深圳气象数据网') {
                            //深圳有区域
                            this.areaSiteDisplay = true;
                            //给深圳的区域赋值
                            this.$http.get('../home/areaDataJson.do?languageType=en', {emulateJSON: true}).then(function (res) {
                                this.baseAreaOption = res.data;
                            });
                        } else if (newValue == '香港天文台' || newValue == '太阳辐射' || newValue == '潮汐数据') {
                            //香港就不给区域了
                            this.areaSiteDisplay = false;
                            //给香港的站点赋值
                            this.$http.get('/home/siteByTypeJson.do?languageType=en&type=' + newValue, {emulateJSON: true}).then(function (res) {
                                console.log(res);
                                this.baseSiteOption = res.data;
                                if (newValue == '潮汐数据' || newValue == '太阳辐射') {
                                    this.$http.get('/home/getObsType.do?languageType=en&type=' + newValue, {emulateJSON: true}).then(function (res) {
                                        console.log(res);
                                        if (newValue == '潮汐数据') {
                                            this.moveMapTo(114.1654600000, 22.2753400000, 12, 0);
                                            this.mapAddTable(res.data, ChaoXiFields)
                                            // this.mapAddJson(res.data,ChaoXiPopupTemplate,ChaoXiFields);
                                        } else if (newValue == '太阳辐射') {
                                            this.moveMapTo(114.1654600000, 22.2753400000, 12, 0);
                                            // console.log(res.data);
                                            this.mapAddJson(res.data, this.SunPopupTemplate(), SunFields);
                                        }
                                    });
                                }
                            });
                        }
                        //加载全部地图
                        this.getWeatherJosn();//初始化区域数据
                    }
                },
                'HistoryValue': {        //历史 --  类别---选择框
                    handler(newValue, oldValue) {
                        this.$http.get('/home/siteByTypeJson.do?languageType=en&type=' + newValue, {emulateJSON: true}).then(function (res) {
                            this.HistorySiteOption = res.data;
                        });
                        this.HistorySiteValue = null;
                        this.tableData = null;
                        this.closeAllTable(this.HistoryValue);
                    }
                },
                'dialogTitle': {        //历史 --  类别---选择框
                    handler(newValue, oldValue) {
                        console.log("newValue:" + newValue);
                        console.log("oldValue:" + oldValue);
                    }
                }, 'baseWeatherArea': {        //历史--数据类型---选择框
                    handler(newValue, oldValue) {
                        this.$http.get('/home/siteByAreaIDJson.do?areaId=' + newValue+"&languageType=en", {emulateJSON: true}).then(function (res) {
                            this.baseSiteOption = res.data;
                        });
                    }
                }, 'baseSiteOption': {        //补丁  - 不知道为啥列表消失，只好重新赋值
                    handler(newValue, oldValue) {
                        if (this.WeatherWebDataValue == '太阳辐射' && newValue.length == 0) {
                            this.baseSiteOption = oldValue;
                        }
                    }
                }, 'moreInputVal': {        //更多--潮汐
                    handler(newValue, oldValue) {
                        if (newValue != "") {
                            // console.log(newValue);
                            this.leftSwitch(3);
                            this.HistoryValue = "潮汐数据";
                            this.HistorySiteValue = newValue;
                            this.$http.get('/home/siteByTypeJson.do?type=' + newValue, {emulateJSON: true}).then(function (res) {
                                this.HistorySiteOption = res.data;
                                this.HistorySiteValue = newValue;
                            });
                            this.HistorySubmit(1);
                        }
                        this.moreInputVal = "";
                    }
                },
                'ObsDataValue': {        //监测 观测类别
                    handler(newValue, oldValue) {
                        this.$http.get('/home/getObsSite.do?languageType=en&type=' + newValue, {emulateJSON: true}).then(function (res) {
                            this.ObsSiteOption = res.data;
                        });
                        this.$http.get('/home/getObsType.do?languageType=en&type=' + newValue, {emulateJSON: true}).then(function (res) {
                            if (newValue == '水质数据') {
                                // console.log(res.data);
                                this.moveMapTo(114.1654600000, 22.2753400000, 12, 0);
                                this.mapAddJson(res.data, WaterPopupTemplate_en, WaterFields);
                            }
                        });
                    }
                },
            },
            methods: {
                SunPopupTemplate() {
                    var pathUlr = "http://" + window.location.host;
                    var SunPopupTemplateReult = {
                        title: " {siteName} "+messages.en.baseData.Water_quality_observation_point,
                        content: messages.en.baseData.Data_acquisition_time+" ：{time}<br/>"+messages.en.baseData.Total_solar_radiation+":<br/><img src='" + pathUlr + "/home/readPartImage.do?address={gross}'/>" +
                        messages.en.baseData.Solar_exposure+" :<br/><img src='" + pathUlr + "/home/readPartImage.do?address={direct}'/>"
                    };
                    return SunPopupTemplateReult;
                }, sevenDayOpen() {
                    //弹窗，我到底是弹个啥呢，是弹个表格，还是弹个统计图
                    this.dialogTitle = W_SITEID + "站  "+messages.en.baseData.View_seven_title;
                    this.IframeSrc = "svenDayDialog.do";
                    // document.getElementById("IframeLayer").src = "svenDayDialog.do";
                    this.sevenDayLayerVisible = true;
                },
                downloadImagFile(row) {
                    this.$http.get('../home/downLoadModisFile.do?ID=' + row.id, {emulateJSON: true}).then(function (res) {
                        console.log(res);
                        if (res.data.code == 200) {
                            window.location.href = "../home/downLoadWindowLoadfile.do?savePath=" + encodeURIComponent(res.data.path) + "&fileName=" + res.data.fileName;
                        } else {
                            this.$message({
                                message: '文件不存在',
                                type: 'error'
                            });
                        }
                    });
                },
                downloadHistory() {
                    //下载历史数据
                    var begindate = null;
                    var enddate = null;
                    if (this.HistoryDate != null) {
                        begindate = this.dateToString(this.HistoryDate[0]);
                        enddate = this.dateToString(this.HistoryDate[1]);
                    }
                    // //表格的显示隐藏
                    // this.$http.get('../home/downLoadAllHistroy.do?siteType=' + this.HistoryValue + '&&siteID=' + this.HistorySiteValue + "&&beginTime=" + begindate + "&&endTime=" + enddate, {emulateJSON: true}).then(function (res) {
                    //         console.log(res);
                    // });
                    window.location.href = '../home/downLoadAllHistroy.do?siteType=' + this.HistoryValue + '&&siteID=' + this.HistorySiteValue + "&&beginTime=" + begindate + "&&endTime=" + enddate;

                },
                HistorySubmit(pageNo) {
                    //历史数中的赛筛选的确认
                    var begindate = null;
                    var enddate = null;
                    if (this.HistoryDate != null) {
                        begindate = this.dateToString(this.HistoryDate[0]);
                        enddate = this.dateToString(this.HistoryDate[1]);
                    }
                    //表格的显示隐藏 
                    this.$http.get('../home/getPageSiteHkObs.do?siteType=' + this.HistoryValue + '&&siteID=' + this.HistorySiteValue + "&&pageNo=" + pageNo + "&&pageSize=10&&beginTime=" + begindate + "&&endTime=" + enddate, {emulateJSON: true}).then(function (res) {

                        this.tableData = res.data.list;
                        this.pageCount = res.data.count;
                        if (this.HistoryValue == '太阳辐射') {
                            this.tableImg = res.data.imgUrl;
                        }
                    });
                },
                handleCurrentChange(val) {
                    //分页的跳转
                    if (this.HistoryImage == true) {
                        this.queryFun(val);
                    } else {
                        this.HistorySubmit(val)
                    }

                },
                getWeatherJosn() {
                    //初始化 深圳气象局数据
                    this.$http.get('../home/siteLonAndLat.do?languageType=en&type=' + this.WeatherWebDataValue, {emulateJSON: true}).then(function (res) {
                        var popupTemplateValue = null;
                        var fieldsValue = null;
                        if (this.WeatherWebDataValue == '深圳气象数据网') {
                            this.moveMapTo(114.0595600000, 22.5428600000, 12, 0);
                            //又得反复重新去写
                            var SZWeatherPopupTemplate = {
                                title: " {siteName} "+messages.en.baseData.Meteorological_Observation_Point+" <div style='display: none'> {fengxiang}{jiangshui}{qiwen}{qiya}{shidu}{shidu}{time}{siteID}</div>",
                                content: function (e) {
                                    var attributes = e.graphic.attributes;
                                    //自己创建一个table
                                    var tableElem = document.createElement("table");
                                    tableElem.class = "layerTable";
                                    var trAll = "<tr><td>"+messages.en.baseData.site_Name+"</td><td>" + attributes.siteName + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.date+"</td><td>" + attributes.time + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.temperature+"</td><td>" + attributes.qiwen + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.rain+"</td><td>" + attributes.jiangshui + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.wind_direction+"</td><td>" + attributes.fengxiang + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.air_pressure+"</td><td>" + attributes.qiya + "</td></tr>"
                                        + "<tr><td>"+messages.en.baseData.wind_speed+"</td><td>" + attributes.shidu + "</td></tr>";
                                    tableElem.innerHTML = trAll;
                                    W_SITEID = attributes.siteName;
                                    console.log(W_SITEID);
                                    //先把span存起来
                                    if (!this.SpanHtmlSeven) {
                                        var spanHtml = document.getElementById("sevenSpan");
                                        this.SpanHtmlSeven = spanHtml;
                                    }
                                    //ID
                                    var siteIDHtml = document.createElement("Input");
                                    siteIDHtml.style.display = "none";
                                    siteIDHtml.value = attributes.siteID;
                                    siteIDHtml.id = "stdeIDElem";

                                    var DivElem = document.createElement("Div");
                                    // DivElem.adde
                                    DivElem.appendChild(tableElem);
                                    DivElem.appendChild(this.SpanHtmlSeven);
                                    DivElem.appendChild(siteIDHtml);
                                    return DivElem;
                                },
                            };

                            popupTemplateValue = SZWeatherPopupTemplate;
                            fieldsValue = SZWeatherFields;
                        } else if (this.WeatherWebDataValue == '香港天文台') {
                            this.moveMapTo(114.1654600000, 22.2753400000, 12, 0);
                            popupTemplateValue = HongKongWeatherPopupTemplate_en;
                            fieldsValue = HongKongWeatherFields;
                        }
                        this.mapAddJson(res.data, popupTemplateValue, fieldsValue)
                        this.loaddingDo();//加载框
                    });
                },
                mapAddJson(data, popupTemplateValue, fieldsValue) {
                    //添加标注点     --其他
                    map.removeAll();
                    var layerFrus = new FeatureLayer({
                        source: data, // autocast as a Collection of new Graphic()
                        objectIdField: "ObjectID",
                        fields: fieldsValue,
                        popupTemplate: popupTemplateValue,
                        renderer: {
                            type: "simple",
                            symbol: {
                                type: "picture-marker",
                                url: "../img/home/site_W_icon.png",
                            }
                        }
                    });
                    map.add(layerFrus);

                },
                loaddingDo() {
                    try {
                        window.parent.toggleLoading();
                    } catch (e) {

                    }
                },
                mapAddTable(data, fieldsValue) {
                    //添加标注点  ---潮汐
                    map.removeAll();
                    var layerFrus = new FeatureLayer({
                        source: data, // autocast as a Collection of new Graphic()
                        objectIdField: "ObjectID",
                        fields: fieldsValue,
                        renderer: {
                            type: "simple",
                            symbol: {
                                type: "picture-marker",
                                url: "../img/home/site_W_icon.png",
                            }
                        }
                    });
                    var popupTemplate = {
                        // autocasts as new PopupTemplate()
                        title: "<span style='background: #0CBDD7; margin-right: 7px;'>&nbsp;</span>{siteName}",
                        outFields: ["*"],
                        content: this.populationChange,
                    };
                    layerFrus.popupTemplate = popupTemplate;
                    map.add(layerFrus);
                },
                leftSwitch(index) { //上方菜单栏切换事件
                    this.indexNubmer = index;
                    this.leftNum = index;
                    for (i = 0; i < this.menuLefts.length; i++) {
                        this.menuLefts[i].url = this.menuLefts[i].url.replace("S.png", ".png");
                    }
                    this.menuLefts[index].url = this.menuLefts[index].url.replace(".png", "S.png");
                    switch (index) {
                        case 0:
                            //影像数据
                            this.queryReust = true; //基础查询显示
                            this.observe = false; //观测数据隐藏
                            this.weatherReust = false; //天气数据隐藏
                            //加上初始化数据类型
                            this.mapShow = false;    //地图关闭
                            this.history = true;   //历史数据打开
                            this.imageSelect();

                            this.HistoryHK = false;
                            this.HistoryChaoxi = false;
                            this.HistoryShuizhi = false;
                            this.HistorySz = false;
                            this.HistorySun = false;
                            this.HistoryImage = true;

                            break;
                        case 1:
                            // 气象数据
                            this.queryReust = false; //基础查询隐藏
                            this.observe = false; //观测数据隐藏
                            this.history = false; //历史数据隐藏
                            this.mapShow = true;    //地图显示
                            this.weatherReust = true;//天气数据显示
                            break;
                        case 2:
                            // 观测数据
                            this.queryReust = false; //基础查询隐藏
                            this.observe = true; //观测数据显示
                            this.history = false;
                            this.weatherReust = false;//天气数据隐藏
                            this.mapShow = true;
                            break;
                        case 3:
                            // 历史数据
                            this.queryReust = false; //基础查询隐藏
                            this.observe = false; //观测数据显示
                            this.history = true;    //历史数据隐藏
                            this.mapShow = false;   //地图显示
                            this.weatherReust = false;//天气数据隐藏
                            break;
                    }

                    if (!this.subisActive) {
                        this.secMenuBut();  //展二级菜单
                    }
                },
                imageSelect() {
                    //获取影像数据的第一个select的值
                    this.$http.get('../home/getAllImageCrawler.do?languageType=en', {emulateJSON: true}).then(function (res) {
                        // console.log(res.data)
                        this.imageTypeSelectData = res.data;
                    });
                },
                secMenuBut() { //左侧二级

                    if (this.indexNubmer == 0) {
                        //如果是第一次的话
                        this.mapShow = false;    //地图关闭
                        this.history = true;   //历史数据打开
                        this.imageSelect();
                    }

                    if (this.subisClose == false && this.subisActive == false) {
                        //初次进入
                        this.subisActive = true; //div显示
                        this.subButShow = true;
                        this.subButJudge = true; //按钮图标更改
                        this.tableActiveShow = true;
                    } else if (this.subisClose) {
                        this.subisClose = false;
                        this.subisActive = true;
                        this.subButJudge = true; //按钮图标更改
                        this.subButShow = true;
                        this.tableActiveShow = true;
                    } else {
                        this.subisClose = true;
                        this.subisActive = false;
                        this.subButJudge = false; //按钮图标更改
                        this.subButShow = false;
                        this.tableActiveShow = false;
                    }

                },
                queryFun(pageNo) {
                    //影像的查询确认事件
                    this.HistoryImage = true;
                    var begindate = null;
                    var enddate = null;
                    if (this.ImageDate != null) {
                        begindate = this.dateToString(this.ImageDate[0]);
                        enddate = this.dateToString(this.ImageDate[1]);
                    }
                    this.$http.get('../home/getImageCrawlerQuery.do?languageType=en&id=' + this.imageTypeSelectValue + "&&pageNo=" + pageNo + "&&pageSize=10&&beginTime=" + begindate + "&&endTime=" + enddate, {emulateJSON: true}).then(function (res) {

                        this.tableData = res.data.list;
                        this.pageCount = res.data.count;
                    });


                },
                closeAllTable(type) {
                    this.HistoryImage = false;  //影像
                    this.HistorySun = false; //太阳辐射
                    this.HistorySz = false;  //深圳气象局
                    this.HistoryShuizhi = false; //水质数据
                    this.HistoryChaoxi = false; //潮汐数据
                    this.HistoryHK = false;// 香港天文台
                    switch (type) {
                        case '香港天文台':
                            this.HistoryHK = true;
                            break;
                        case '潮汐数据':
                            this.HistoryChaoxi = true;
                            break;
                        case '水质数据':
                            this.HistoryShuizhi = true;
                            break;
                        case '深圳气象数据网':
                            this.HistorySz = true;
                            break;
                        case '太阳辐射':
                            this.HistorySun = true;
                            break;
                    }
                },
                openDe() {
                    // console.log("sha");
                },
                queryWeaterFun(type) {

                    // console.log(type);
                    //气象数据查确认
                    //经纬度移动
                    var stid = "";
                    if (type == 'weather') {//气象的确定
                        stid = this.baseWeatherSite;
                    } else if (type == 'obs') {//观测的确定
                        stid = this.ObsSiteValue;
                    }
                    if (stid == null || stid == '') {
                        this.$message({
                            message: '请选择站点',
                            type: 'error'
                        });
                        return;
                    }
                    console.log(stid);
                    this.$http.get('../home/getSiteXY.do?id=' + stid, {emulateJSON: true}).then(function (res) {
                        var dataValue = res.data;
                        this.moveMapTo(dataValue.X, dataValue.Y, 14, 1);
                    });
                },
                moveMapTo(long, lat, zoom, type) {
                    // console.log(long, lat);
                    //移动地图
                    var pt = new Point({
                        latitude: lat,
                        longitude: long
                    });
                    var opts = {
                        duration: 2000  // 动画时间
                    };
                    view.goTo({
                        target: pt,
                        zoom: zoom,
                    }, opts);
                    //为了显著，加上一个img
                    view.graphics.removeAll();
                    if (type == 1) {
                        var pointGraphic = new Graphic({
                            geometry: {
                                type: "point",
                                longitude: long,
                                latitude: lat
                            },
                            symbol: {
                                type: "picture-marker",	//样式 这里可以用图片也可以用图标，或者干脆就一个点
                                width: "30px",
                                height: "30px",
                                url: "../img/home/mapIen.png",
                                outline: {
                                    // autocasts as new SimpleLineSymbol()
                                    color: [255, 255, 255],
                                    width: 1
                                }
                            }
                        });
                        view.graphics.add(pointGraphic);
                    }

                },
                handleCheckAllChange(val) {
                    //多选框全选
                    this.checkedCities = val ? cityOptions : [];
                    this.isIndeterminate = false;
                }, dateToString(date) {
                    // 将data转化为String
                    var year = date.getFullYear();
                    var month = (date.getMonth() + 1).toString();
                    var day = (date.getDate()).toString();
                    if (month.length == 1) {
                        month = "0" + month;
                    }
                    if (day.length == 1) {
                        day = "0" + day;
                    }
                    var dateTime = year + "-" + month + "-" + day;
                    return dateTime;
                }, dateFormatTime(row, column) {
                    //表格上面格式化时间
                    var date = row[column.property];
                    if (date == null) {
                        return "";
                    }
                    return new Date(parseInt(date)).toLocaleString().replace(/:\d{1,2}$/, ' ');
                }, dateFormatData(row, column) {
                    //表格上面格式化日期
                    var datec = row[column.property];
                    var now = new Date(datec);   //创建一个指定的日期对象
                    var year = now.getFullYear();  //取得4位数的年份
                    var month = now.getMonth() + 1;  //取得日期中的月份，其中0表示1月，11表示12月
                    var day = now.getDate();      //返回日期月份中的天数（1到31）
                    return year + "年" + month + "月" + day + "日"
                },
                handleCheckedCitiesChange(value) {
                    let checkedCount = value.length;
                    this.checkAll = checkedCount === this.cities.length;
                    this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
                }, createTable(Thead, Tname, Tvalue) {
                    //构建并返回table
                    var tabl = "<thead>";
                    for (var i = 0; i < Thead.length; i++) {
                        tabl = tabl + "<th>" + Thead[i] + "</td>";
                    }
                    tabl = tabl + "</thead><tbody>";
                    var td = "";
                    for (var i = 0; i < Tname.length; i++) {
                        td = td + "<tr><td>" + Tname[i] + "</td><td>" + Tvalue[i] + "</td></tr>"
                    }
                    return tabl + td + "</tbody>";
                }, populationChange(feature) {
                    // console.log(feature);
                    var attributes = feature.graphic.attributes;
                    var Thead = new Array(messages.en.baseData.time, messages.en.baseData.height);
                    var Tname = new Array(attributes.time1, attributes.time2, attributes.time3, attributes.time4);
                    var Tvalue = new Array(attributes.hight1, attributes.hight3, attributes.hight3, attributes.hight4);
                    //因为存在使用过一次的数据就感觉被剪切掉了一样，所以需要吧上一次的数据重新赋值进去
                    if (document.getElementById("allLayerMore").innerText.length < 20) {
                        document.getElementById("allLayerMore").appendChild(replaceDiv);
                    }
                    //创建一个可以存储siteID 的input
                    //首先删除元素
                    var idObject = document.getElementById('typeId');
                    if (idObject != null) {
                        idObject.parentNode.removeChild(idObject);
                    }
                    var newInput = document.createElement("input");
                    newInput.type = "hidden";
                    newInput.id = "typeId";
                    // console.log(attributes.siteID)
                    newInput.value = attributes.siteID;
                    document.getElementById("moreContent").appendChild(newInput);
                    document.getElementById("LayerTable").innerHTML = this.createTable(Thead, Tname, Tvalue);
                    var div = document.getElementById("moreDiv");
                    if (replaceDiv == null) {
                        replaceDiv = div;
                    }
                    return div;
                }
            }
        });


    });